/**
 * 文件下载
 * @param response ajax返回的文件流
 */
export function downloadFile(response: any) {
  //从响应头中获取文件名
  const fileName: string = response.headers['content-disposition'].split('=')[1];
  const url = window.URL.createObjectURL(new Blob([response]));
  const link = document.createElement('a');
  link.href = url;
  link.setAttribute('download', fileName); // 根据实际文件类型调整
  document.body.appendChild(link);
  link.click();
  document.body.removeChild(link);
}
